<template>
  <div class="sidebar" :class="{ 'sidebar-open': isOpen }">
    <button class="close-btn" @click="toggleSidebar">
      <font-awesome-icon icon="fas fa-times" />
    </button>
    <ul>
      <li>菜单项1</li>
      <li>菜单项2</li>
      <li>菜单项3</li>
    </ul>
  </div>
</template>

<script>
export default {
  props: {
    isOpen: {
      type: Boolean,
      required: true
    }
  },
  methods: {
    toggleSidebar() {
      this.$emit('toggle-sidebar', !this.isOpen);
    }
  }
};
</script>

<style scoped>
.sidebar {
  position: fixed;
  top: 0;
  left: -300px;
  width: 300px;
  height: 100%;
  background-color: #fff;
  box-shadow: 2px 0 4px rgba(0, 0, 0, 0.1);
  transition: left 0.3s ease;
  z-index: 999;
}

.sidebar-open {
  left: 0;
}

.close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background-color: transparent;
  border: none;
  cursor: pointer;
  font-size: 24px;
}

.sidebar ul {
  list-style: none;
  padding: 16px;
  margin: 0;
}

.sidebar ul li {
  padding: 8px 0;
  cursor: pointer;
}

.sidebar ul li:hover {
  background-color: #f0f0f0;
}
</style>